package ltd.dujiabao.capability.domain.rulemng.expression;

import ltd.dujiabao.capability.domain.capmng.cap.Capability;

/**
 * @author : DuJiabao
 * @Project : ddd-capability
 * @Time : 2024/4/13 17:41
 * @Desc :
 */
public class StartsWithExpression extends BaseExpression{

    public StartsWithExpression(String module, String key, ExpressionType expressionType, String target) {
        super(module, key, expressionType, target);
    }

    @Override
    public boolean check(Capability capability) {
        return findValue(capability)
                .map(value -> value.startsWith(target))
                .orElse(false);
    }
}
